package com.tian.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tian.framework.security.domian.SecurityRole;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tian.framework.security.domian.SecurityUser;
import java.util.Date;
import java.util.List;

/**
 * 用户表表 User
 *
 * @author zcx
 * @creatDate 2019-12-09 15:30:35
*/
public class User extends SecurityUser {
	private static final long serialVersionUID = 1L;

	/** 用户编号*/
	private int userId;
	/** 用户姓名*/
	private String userName;
	/** 用户密码*/
	private String password;
	/** 登录名*/
	private String loginName;
	/** 邮箱*/
	private String email;
	/** 手机号*/
	private String phone;
	/** 注册日期*/
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date registerDate;
	/** 地址*/
	private String address;
	/** 状态 0：禁用 1：启用*/
	private int state;
	/** keycloak用户编号*/
	private String keycloakId;

	/** 用户角色*/
	private List<SecurityRole> roles;

    /** 用户编号*/
	public void setUserId(int userId){
		this.userId = userId;
	}
    /** 用户编号*/
	@Override
	public int getUserId(){
		return userId;
	}

    /** 用户姓名*/
	public void setUserName(String userName){
		this.userName = userName;
	}
    /** 用户姓名*/
	@Override
	public String getUserName(){
		return userName;
	}

	@Override
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	/** 登录名*/
	public void setLoginName(String loginName){
		this.loginName = loginName;
	}
    /** 登录名*/
	public String getLoginName(){
		return loginName;
	}

	/** 邮箱*/
	public String getEmail() {
		return email;
	}
	/** 邮箱*/
	public void setEmail(String email) {
		this.email = email;
	}

	/** 手机号*/
	public void setPhone(String phone){
		this.phone = phone;
	}
    /** 手机号*/
	public String getPhone(){
		return phone;
	}

    /** 注册日期*/
	public void setRegisterDate(Date registerDate){
		this.registerDate = registerDate;
	}
    /** 注册日期*/
	public Date getRegisterDate(){
		return registerDate;
	}

    /** 地址*/
	public void setAddress(String address){
		this.address = address;
	}
    /** 地址*/
	public String getAddress(){
		return address;
	}

    /** 状态 0：禁用 1：启用*/
	public void setState(int state){
		this.state = state;
	}
    /** 状态 0：禁用 1：启用*/
	public int getState(){
		return state;
	}

	/** 用户角色*/
	@Override
	public List<SecurityRole> getRoles() {
		return roles;
	}

	/** 账户没有过期*/
	@Override
	public boolean getAccountNonExpired() {
		return true;
	}
	/** 是否可用*/
	@Override
	public boolean getEnabled() {
		return true;
	}
	/** 密码没有过期*/
	@Override
	public boolean getCredentialsNonExpired() {
		return true;
	}
	/** 帐号没有被锁定*/
	@Override
	public boolean getAccountNonLocked() {
		return true;
	}

	/** 用户角色*/
	public void setRoles(List<SecurityRole> roles) {
		this.roles = roles;
	}
	/** keycloak用户编号*/
	public String getKeycloakId() {
		return keycloakId;
	}
	/** keycloak用户编号*/
	public void setKeycloakId(String keycloakId) {
		this.keycloakId = keycloakId;
	}

	public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("userId", getUserId())
            .append("userName", getUserName())
            .append("loginName", getLoginName())
            .append("phone", getPhone())
            .append("registerDate", getRegisterDate())
            .append("address", getAddress())
            .append("state", getState())
            .toString();
    }
}
